package com.muchenx;

import com.muchenx.util.UIComponentUtil;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import org.kordamp.bootstrapfx.BootstrapFX;

import java.io.IOException;

public class App extends Application {

    public static void main(String[] args) {
        launch();
    }

    @Override
    public void start(Stage stage) throws IOException {
        setStageProps(stage);
        Scene scene = new Scene(new FXMLLoader(getClass().getResource("main-view.fxml")).load());
        scene.getStylesheets().add(BootstrapFX.bootstrapFXStylesheet());
        stage.setScene(scene);
        stage.sizeToScene();// 自适应窗口
        stage.show();
    }

    private void setStageProps(Stage stage) {
        UIComponentUtil.addIcon(stage);
        stage.setTitle("MP Code Generation Tool");
        stage.initStyle(StageStyle.DECORATED);
        stage.setFullScreen(false);
        stage.setResizable(false);
    }
}